sort number in dynamo

81

sort number in dynamo -

import re

liste = IN[0]

def natural_sort(l): 
    convert = lambda text: int(text) if text.isdigit() else text.lower() 
    alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] 
    return sorted(l, key = alphanum_key)

OUT = natural_sort(liste)

Comments

Submit
0 Comments